package main

import (
	"github.com/gin-gonic/gin"
	"github.com/gookit/color"
	"io"
)

func main() {
	engine := gin.Default()
	engine.Use(func(context *gin.Context) {

	})
	engine.Any("/*all", func(ctx *gin.Context) {
		color.Yellowln("RequestURI", ctx.Request.RequestURI)
		color.Yellowln("Method", ctx.Request.Method)
		color.Yellowln("Form", ctx.Request.Form)
		color.Yellowln("URL", ctx.Request.URL)
		if ctx.Request.Header != nil {
			for s, strings := range ctx.Request.Header {
				color.Greenln(s, strings)
			}
		}
		all, err := io.ReadAll(ctx.Request.Body)
		if err != nil {
			color.Redln(err.Error())
			ctx.AbortWithStatusJSON(401, nil)
		}
		color.Redln("body", string(all))
	})
	engine.Run(":8080")
}
